/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author mona
 */
public class ProgressBar extends javax.swing.JFrame {

    double inc;
    double loaded;
    /**
     * Creates new form ProgressBar
     * @param nameOfFile
     * @param fileSize
     */
    public ProgressBar(String nameOfFile, int fileSize,String type) {
        initComponents();
        
        if(nameOfFile.length() > 10)
            nameOfFile = nameOfFile.substring(0, 10)+"..";
        jLabel2.setText(nameOfFile);
        jProgressBar2.setMaximum(100);
        jProgressBar2.setValue(0);
        inc = (100 * 4000.0) / fileSize;
        loaded = 0;
        setTitle(type);
    }

    public void incrementSize(){
        loaded += inc;
        jProgressBar2.setValue((int)loaded);
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jProgressBar2 = new javax.swing.JProgressBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setPreferredSize(new java.awt.Dimension(600, 100));
        getContentPane().setLayout(new java.awt.BorderLayout(10, 0));

        jLabel2.setText("jLabel2");
        getContentPane().add(jLabel2, java.awt.BorderLayout.LINE_START);
        getContentPane().add(jProgressBar2, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel2;
    private javax.swing.JProgressBar jProgressBar2;
    // End of variables declaration//GEN-END:variables
}
